<template>
  <div class="app">
   	<HeaderTop v-if="isShow"></HeaderTop>
    <!-- <HeaderNav v-if="isShow"></HeaderNav> -->
	<keep-alive>
	    <router-view class="content"></router-view>
	</keep-alive>
    <Foot v-if="isShow"></Foot> 
  </div>
</template>

<script>
	import {mapState} from 'vuex'
	import HeaderTop from '@/components/HeaderTop.vue'
	import Foot from '@/components/Foot.vue'
	export default {
		components:{
			HeaderTop,
	        Foot,
		},
		computed:mapState({
			isShow:state => state.app.isShow,
			userProfile:state=>state.app.userProfile
		}),
		data(){
			return {
				
			}
		},
		methods:{
			ieCheck(){
		        if(navigator.userAgent.indexOf("MSIE")>0){   

		         // if(navigator.userAgent.indexOf("MSIE 6.0")>0){  

		         //    alert("當前瀏覽器版本過低，請升級到ie10以上（包括ie10）或更換其他瀏覽器才能正常瀏覽，不便之處盡請原諒");
		         //    window.location.href="http://jiaoxueyun.com/download.jsp"

		         //  }   

		          if(navigator.userAgent.indexOf("MSIE 7.0")>0){  

		          	this.$alert('當前瀏覽器版本過低，請升級到ie10以上（包括ie10）或更換其他瀏覽器才能正常瀏覽，不便之處盡請原諒', {
		                confirmButtonText: '确定',
		                callback: action => {
				             window.location.href="http://jiaoxueyun.com/download.jsp"
				        }
		            });

		            // window.location.href="http://jiaoxueyun.com/download.jsp"
		          }   

		          if(navigator.userAgent.indexOf("MSIE 9.0")>0 && !window.innerWidth){//这里是重点，你懂的

		             this.$alert('當前瀏覽器版本過低，請升級到ie10以上（包括ie10）或更換其他瀏覽器才能正常瀏覽，不便之處盡請原諒', {
		                confirmButtonText: '确定',
		                callback: action => {
				             window.location.href="http://jiaoxueyun.com/download.jsp"
				        }
		            });
		             
		          }   

		          if(navigator.userAgent.indexOf("MSIE 9.0")>0){  

		            this.$alert('當前瀏覽器版本過低，請升級到ie10以上（包括ie10）或更換其他瀏覽器才能正常瀏覽，不便之處盡請原諒', {
		                confirmButtonText: '确定',
		                callback: action => {
				             window.location.href="http://jiaoxueyun.com/download.jsp"
				        }
		            });
		            // window.location.href="http://jiaoxueyun.com/download.jsp"

		          }   

		        } 
		    }
		},
		mounted(){
			this.ieCheck();
		},
		watch:{
			userProfile(userProfile){
				this.$http.defaults.headers['token']=userProfile.token;
			}
		}
	}
</script>

<style lang="scss">
</style>
